#include "stdafx.h"
#include "CGALHead.h"
void InitLoadDataAsOff(CFileLoadData& fp)
{
	fp.GetStream().setf(ios::fixed, ios::floatfield);
	fp.GetStream().precision(6);
}
void InitSaveDataAsOff(CFileSaveData& fp)
{
	fp.GetStream().setf(ios::fixed, ios::floatfield);
	fp.GetStream().precision(6);
}
void SaveMeshAsOff(const Surface_mesh& mesh, CFileSaveData& fp)
{
	InitSaveDataAsOff(fp);
	 fp << mesh;
}
void SaveMeshAsOff(const Surface_mesh& mesh, string sFileName)
{
	std::ofstream out;
	out.open(sFileName);
	out.setf(ios::fixed, ios::floatfield);
	out.precision(6);
	out << mesh;
	out.close();
};

void LoadMeshAsOff(Surface_mesh& mesh, CFileLoadData& fp)
{
	fp >> mesh;
}

void LoadMeshAsOff(Surface_mesh& mesh, string sFileName)
{
	std::ifstream out;
	out.open(sFileName);
	if (out.is_open())
	{
		out >> mesh;
		out.close();
	}
	

}

string PrintVLine(const vector<vector<Point_3>>& vLine)
{
	string ret;
	for (auto vPnt : vLine)
	{
		ret += PrintLine(vPnt.begin(), vPnt.end());
		ret += "\n";
	}
	return ret;
}
